﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LambdaAnonimousExtensionMethods
{
    public class Student
    {
       public string FirstName
        {
            get;
            set;
        }
       public string LastName
        {
            get;
            set;
        }
       public int Age
       {
           get;
           set;
       }
        public Student(string f,string l,int a)
        {
            FirstName=f;
            LastName=l;
            Age = a;
        }
        public override string ToString()
        {
            return FirstName+" "+ LastName;
        }

    }
    public static class LinqMethods
    {
        public static IEnumerable<Student> GreaterFirst(this IEnumerable<Student> allStudents)
        {
            var result =
                from student in allStudents
                where student.FirstName.CompareTo(student.LastName) > 0
                select student;
            allStudents = result;
            return result;


        }

        public static string UpperFirtsLetter(this string str)
        {
            string[] words = str.Split();
            StringBuilder myBuild = new StringBuilder();
            foreach (var item in words)
            {
                myBuild.Append(item[0].ToString().ToUpper());
                    for (int i = 1; i < item.Length; i++)
			    {
			    myBuild.Append(item[i]);
			    }
                myBuild.Append(" ");
            }
            return myBuild.ToString();
        }


    }
}
